<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			div{
				border: black 1px solid;
				position: relative;
			}
			#d1{width: 250px;height: 250px;}
			#d2{width: 200px;height: 200px;left: 25px;top: 25px;}
			#d3{width: 150px;height: 150px;left: 25px;top: 25px;}
			#d4{width: 100px;height: 100px;left: 25px;top: 25px;}
			#d5{width: 50px;height: 50px;left: 25px;top: 25px;}
		</style>
	</head>
	<body>
		<div id="d1">
			<div id="d2">
				<div id="d3">
					<div id="d4">
						<div id="d5"></div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			var divs = document.querySelectorAll("div");
			for (let i = 0; i < divs.length; i++) {
				divs[i].onmouseover = function(){
					//event.target.setAttribute("style","background-color: gray;")
					this.setAttribute("style","background-color: gray;")
				}
				divs[i].onmouseout = function(){
					event.target.setAttribute("style","background-color: white;")
				}
			}
			
		</script>
	</body>
</html>
